home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 41.zip
/
BS1 part 41
/
Compute`s Amiga resource 1.adf
/
Source
/
8ColorWbench
/
Normalbench.a
< prev
next >
Wrap
Text File
|
1989-02-08
|
3KB
|
117 lines
;*************************************************************************
;
; Normalbench.a
;
; Return the Workbench screen to normal. (Reverses the effect of
; Colorbench.)
;
;*************************************************************************
; Constants
_AbsExecBase EQU 4 ;base addr for Exec
_CloseLibrary EQU -414
_FreeRaster EQU -498
_RemakeDisplay EQU -384
_OpenWorkBench EQU -210
_OpenLibrary EQU -552
LIB_VERSION EQU 32 ;KS 1.2 or higher
BITMAP EQU 88 ;offset to BitMap structure
DEPTH EQU 5 ;offset to number of bitplanes
WIDTH EQU 12 ;offset to bitplane width
HEIGHT EQU 14 ;offset to bitplane height
PLANES EQU 16 ;offset to 3rd bitplane ptr
SECTION Program,CODE
Start:
movea.l _AbsExecBase,a6 ;get ptr to Exec library
; open intuition library
lea IntuitionName,a1 ;ptr to "intuition.library"
moveq.l #LIB_VERSION,d0 ;set library version
jsr _OpenLibrary(a6) ;call OpenLibrary
move.l d0,IntuitionBase ;store the addr
beq Exit ;problem -- drop out
; open graphics library
lea GfxName,a1 ;ptr to "graphics.library"
moveq.l #LIB_VERSION,d0 ;set library version
jsr _OpenLibrary(a6) ;call OpenLibrary
move.l d0,GfxBase ;store the addr
beq CloseIntuition ;problem -- drop out
; get a ptr to the workbench screen structure using OpenWorkBench
movea.l IntuitionBase,a6 ;base addr of intuition library
jsr _OpenWorkBench(a6) ;call OpenWorkBench
move.l d0,Scr ;store the addr
beq AllDone ;problem -- drop out
; get a ptr to the BitMap structure within the screen's RastPort structure
movea.l Scr,a0
move.l BITMAP(a0),bm
; decide whether to discard a bitplane
movea.l bm,a0
move.b DEPTH(a0),d0
cmpi.b #3,d0 ;3 bitplanes?
bne AllDone ;no
; yes, so discard one
movea.l Scr,a0
move.w HEIGHT(a0),d1 ;height of bitplane in d1
move.w WIDTH(a0),d0 ;width of bitplane in d0
movea.l bm,a1
movea.l PLANES(a1),a0 ;addr of bitplane in a0
movea.l GfxBase,a6
jsr _FreeRaster(a6) ;call FreeRaster
; set the number of bitplanes to 2
movea.l bm,a0
move.b #2,DEPTH(a0) ;bm->DEPTH = 2
; rebuild the display
movea.l IntuitionBase,a6
jsr _RemakeDisplay(a6) ;call RemakeDisplay
;fall through to AllDone
; finish by closing the libraries
AllDone:
movea.l GfxBase,a1 ;close graphics.library
movea.l _AbsExecBase,a6
jsr _CloseLibrary(a6) ;call CloseLibrary
CloseIntuition:
movea.l IntuitionBase,a1 ;close intuition.library
jsr _CloseLibrary(a6) ;call CloseLibrary
Exit:
rts ;back to CLI
SECTION InitData,DATA
IntuitionName:
dc.b 'intuition.library',0
GfxName:
dc.b 'graphics.library',0
SECTION UnInitData,BSS
Scr ds.l 1
bm ds.l 1
IntuitionBase ds.l 1
GfxBase ds.l 1
end